*********************************************************************************************************************************
*********************************************************************************************************************************
******************** 	REPLICATION FOR: 																	  	*****************
********************	THE PRICE OF PROBITY: ANTICORRUPTION AND ADVERSE SELECTION IN THE CHINESE BUREAUCRACY 	*****************
*********************************************************************************************************************************
*********************************************************************************************************************************
** Author: Junyan Jiang, Zijie Shao, and Zhiyuan Zhang
** Last Updated: June 22, 2020
** Environment: 
*** Stata 14.1 SE
*** Windows 10 x64, Intel i-7-7500U
*** 16GB RAM

use data_main, clear


******************************************************************************************************************
******************************************************************************************************************
**************************************************** ANALYSIS ****************************************************
******************************************************************************************************************
******************************************************************************************************************


global econ gdppc total_pop exp priscale 
global w_econ gdppc total_pop exp priscale 


***********************************************************************
**********  Table 1: Baseline Results (Major cases) *******************
***********************************************************************


eststo clear
// activities //
eststo m1: reg ab_rescale   i.colprov    disciplined_1   ///
if govjob==1 , robust  cluster(colprov)
estadd local colprov "\(\checkmark\)"


eststo m2: ivreg2 ab_rescale  i.colprov      (disciplined_1   = postac2 xipost)  ///
if govjob==1 , robust partial( i.colprov    ) cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local colprov "\(\checkmark\)"


eststo m3: ivreg2 ab_rescale i.univ i.colprov  female minor  age gy (disciplined_1   = postac2 xipost)  ///
if govjob==1   , robust partial(i.univ i.colprov  female minor age gy) cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"


eststo m4: ivreg2 ab_rescale i.univ i.colprov  female minor age gy $econ (disciplined_1  = postac2 xipost)  ///
if govjob==1, robust partial(i.univ i.colprov  female minor age gy)  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"
estadd local ctrl "\(\checkmark\)"


// achievements //
eststo m5: reg gs_rescale   i.colprov    disciplined_1   ///
if govjob==1 , robust  cluster(colprov)
estadd local colprov "\(\checkmark\)"


eststo m6: ivreg2 gs_rescale   i.colprov    (disciplined_1  = postac2 xipost)  if govjob==1, ///
robust partial(i.colprov  )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local colprov "\(\checkmark\)"

eststo m7: ivreg2 gs_rescale i.univ i.colprov  female minor age gy (disciplined_1  = postac2 xipost)  if govjob==1, ///
robust partial(i.univ i.colprov  female minor age gy)  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"


eststo m8: ivreg2 gs_rescale i.univ i.colprov  female minor gy age $econ (disciplined_1  = postac2 xipost)  if govjob==1, ///
robust partial(i.univ i.colprov  female minor age gy )   cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"
estadd local ctrl "\(\checkmark\)"



esttab m*  using out.txt, nonote nobaselevels keep(disciplined_1) b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
mtitles("OLS" "IV" "IV" "IV" "OLS" "IV" "IV" "IV") mgroup("Activities in college" "Achievements in college", pattern(1 0 0 0 1 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(colprov uni indi ctrl   hj N, labels("College province FE" "MPA program FE" "Individual-level controls" "Province-level controls"   "Hansen's J (p value)" "Observations") fmt(0 0 0 0 2  0) )



*****************************************************************
******************* Table 2: Compositional Effect ***************
*****************************************************************

eststo clear

// farmer parents //
eststo m0: reg parent_farmer   i.colprov    disciplined_1   ///
if govjob==1 , robust  cluster(colprov)
estadd local colprov "\(\checkmark\)"


eststo m1: ivreg2 parent_farmer   i.colprov      (disciplined_1   = postac2 xipost)  ///
if govjob==1   , robust partial( i.colprov    ) cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local colprov "\(\checkmark\)"


eststo m2: ivreg2 parent_farmer i.univ i.colprov  female minor age   gy (disciplined_1   = postac2 xipost)  ///
if govjob==1   , robust partial(i.univ i.colprov  female minor age gy) cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"


eststo m3: ivreg2 parent_farmer i.univ i.colprov  female minor age gy $econ (disciplined_1  = postac2 xipost)  ///
if govjob==1, robust partial(i.univ i.colprov  female minor age gy $econ)  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"
estadd local ctrl "\(\checkmark\)"


// official parents //
eststo m5: reg parent_govx   i.colprov    disciplined_1   ///
if govjob==1 , robust  cluster(colprov)
estadd local colprov "\(\checkmark\)"


eststo m6: ivreg2 parent_govx   i.colprov    (disciplined_1  = postac2 xipost)  if govjob==1, ///
robust partial(i.colprov  )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local colprov "\(\checkmark\)"

eststo m7: ivreg2 parent_govx i.univ i.colprov  female minor age gy (disciplined_1  = postac2 xipost)  if govjob==1, ///
robust partial(i.univ i.colprov  female minor gy age)  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"


eststo m8: ivreg2 parent_govx i.univ i.colprov  female minor age gy $econ (disciplined_1  = postac2 xipost)  if govjob==1, ///
robust partial(i.univ i.colprov  female minor age gy $econ)   cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"
estadd local ctrl "\(\checkmark\)"



esttab m*  using out.txt, nonote nobaselevels keep(disciplined_1) b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
mtitles("OLS" "IV" "IV" "IV" "OLS" "IV" "IV" "IV") mgroup("Farmer parents" "Official parents", pattern(1 0 0 0 1 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(colprov uni indi ctrl   hj N, labels("College province FE" "MPA program FE" "Individual-level controls" "Province-level controls"   "Hansen's J (p value)" "Observations") fmt(0 0 0 0 2  0) )




******************************************************************************
**************** Table 3: Use Direct Measure of Family Economic Status ****************
******************************************************************************


eststo clear
// economic hardship //
eststo m0: reg econhard   i.colprov    disciplined_1   ///
if govjob==1 , robust  cluster(colprov)
estadd local colprov "\(\checkmark\)"


eststo m1: ivreg2 econhard   i.colprov      (disciplined_1   = postac2 xipost)  ///
if govjob==1   , robust partial( i.colprov    ) cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local colprov "\(\checkmark\)"


eststo m2: ivreg2 econhard i.univ i.colprov  female minor age   gy (disciplined_1   = postac2 xipost)  ///
if govjob==1   , robust partial(i.univ i.colprov  female minor age gy) cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"


eststo m3: ivreg2 econhard i.univ i.colprov  female minor age gy $econ (disciplined_1  = postac2 xipost)  ///
if govjob==1, robust partial(i.univ i.colprov  female minor age gy $econ)  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"
estadd local ctrl "\(\checkmark\)"

// work-study//
eststo m5: reg workpay   i.colprov    disciplined_1   ///
if govjob==1 , robust  cluster(colprov)
estadd local colprov "\(\checkmark\)"

eststo m6: ivreg2 workpay   i.colprov    (disciplined_1  = postac2 xipost)  if govjob==1, ///
robust partial(i.colprov  )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local colprov "\(\checkmark\)"

eststo m7: ivreg2 workpay i.univ i.colprov  female minor age gy (disciplined_1  = postac2 xipost)  if govjob==1, ///
robust partial(i.univ i.colprov  female minor gy age)  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"


eststo m8: ivreg2 workpay i.univ i.colprov  female minor age gy $econ (disciplined_1  = postac2 xipost)  if govjob==1, ///
robust partial(i.univ i.colprov  female minor age gy $econ)   cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"
estadd local ctrl "\(\checkmark\)"





esttab m*  using out.txt, nonote nobaselevels keep(disciplined_1) b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
mtitles("OLS" "IV" "IV" "IV" "OLS" "IV" "IV" "IV") mgroup("Past Economic Hardship" "Participation in Work-Study", pattern(1 0 0 0 1 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(colprov uni indi ctrl   hj N, labels("College province FE" "MPA program FE" "Individual-level controls" "Province-level controls"   "Hansen's J (p value)" "Observations") fmt(0 0 0 0 2  0) )




*************************************************************************************
****************	Figure 3: Varying Estimation Bandwidths *************************
*************************************************************************************
// Note: The code below is for exporting the estimates. Plotting the actual figure is done in R //

// Activities //
capture drop beta ub90 lb90
mat D=J(9,3,99)
mat colnames D= beta ub90 lb90
forv i=2005/2013{
ivreg2 ab_rescale   i.univ i.colprov   female minor   (disciplined_1   = postac2 xipost )  ///
if govjob==1 & gy>=`i' , robust  cluster(colprov)
mat D[`i'-2004,1]=_b[disciplined_1]
mat D[`i'-2004,2]=_b[disciplined_1]-1.64*_se[disciplined_1]
mat D[`i'-2004,3]=_b[disciplined_1]+1.64*_se[disciplined_1]
}
mat list D
svmat D, names(col)
outsheet beta ub90 lb90 using pb_ab.csv, comma replace
 
// Awards //
capture drop beta ub90 lb90
mat D=J(9,3,99)
mat colnames D= beta ub90 lb90
forv i=2005/2013{
ivreg2 gs_rescale   i.univ i.colprov   female minor   (disciplined_1   = postac2 xipost )  ///
if govjob==1 & gy>=`i' , robust  cluster(colprov)
mat D[`i'-2004,1]=_b[disciplined_1]
mat D[`i'-2004,2]=_b[disciplined_1]-1.64*_se[disciplined_1]
mat D[`i'-2004,3]=_b[disciplined_1]+1.64*_se[disciplined_1]
}
mat list D
svmat D, names(col)
outsheet beta ub90 lb90 using pb_gs.csv, comma replace


// Farmer parents //

capture drop beta ub90 lb90
mat D=J(9,3,99)
mat colnames D= beta ub90 lb90
forv i=2005/2013{
ivreg2 parent_farmer   i.univ i.colprov   female minor   (disciplined_1   = postac2 xipost )  ///
if govjob==1 & gy>=`i' , robust  cluster(colprov)
mat D[`i'-2004,1]=_b[disciplined_1]
mat D[`i'-2004,2]=_b[disciplined_1]-1.64*_se[disciplined_1]
mat D[`i'-2004,3]=_b[disciplined_1]+1.64*_se[disciplined_1]
}
mat list D
svmat D, names(col)
outsheet beta ub90 lb90 using pb_farmer.csv, comma replace

// Official parents //

capture drop beta ub90 lb90
mat D=J(9,3,99)
mat colnames D= beta ub90 lb90
forv i=2005/2013{
ivreg2 parent_govx  i.univ i.colprov   female minor   (disciplined_1   = postac2 xipost )  ///
if govjob==1 & gy>=`i' , robust  cluster(colprov)
mat D[`i'-2004,1]=_b[disciplined_1]
mat D[`i'-2004,2]=_b[disciplined_1]-1.64*_se[disciplined_1]
mat D[`i'-2004,3]=_b[disciplined_1]+1.64*_se[disciplined_1]
}
mat list D
svmat D, names(col)
outsheet beta ub90 lb90 using pb_govx.csv, comma replace


// Economic hardship //

capture drop beta ub90 lb90
mat D=J(9,3,99)
mat colnames D= beta ub90 lb90
forv i=2005/2013{
ivreg2 econhard   i.univ i.colprov   female minor gy     (disciplined_1   = postac2 xipost )  ///
if govjob==1 & gy>=`i' , robust  cluster(colprov)
mat D[`i'-2004,1]=_b[disciplined_1]
mat D[`i'-2004,2]=_b[disciplined_1]-1.64*_se[disciplined_1]
mat D[`i'-2004,3]=_b[disciplined_1]+1.64*_se[disciplined_1]
}
mat list D
svmat D, names(col)
outsheet beta ub90 lb90 using pb_econhard.csv, comma replace


// Work pay //

capture drop beta ub90 lb90
mat D=J(9,3,99)
mat colnames D= beta ub90 lb90
forv i=2005/2013{
ivreg2 workpay   i.univ i.colprov   female minor   (disciplined_1   = postac2 xipost )  ///
if govjob==1 & gy>=`i' , robust  cluster(colprov)
mat D[`i'-2004,1]=_b[disciplined_1]
mat D[`i'-2004,2]=_b[disciplined_1]-1.64*_se[disciplined_1]
mat D[`i'-2004,3]=_b[disciplined_1]+1.64*_se[disciplined_1]
}
mat list D
svmat D, names(col)
outsheet beta ub90 lb90 using pb_workpay.csv, comma replace




************************************************************************
****************	Table 4: Robustness Checks *************************
************************************************************************

*************  Matched with Work Province *******************

eststo clear

eststo m1: ivreg2 ab_rescale i.univ i.workprov  female minor age gy  (w_disciplined_1  = w_postac2 w_xipost)  if govjob==1, ///
robust partial(i.univ i.workprov  female minor gy age )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"

eststo m2: ivreg2 gs_rescale i.univ i.workprov  female minor age gy   (w_disciplined_1  = postac2 xipost)  if govjob==1, ///
robust partial(i.univ i.workprov  female minor gy age  )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"

eststo m3: ivreg2 parent_farmer i.univ i.workprov  female minor age gy   (w_disciplined_1  = postac2 xipost)  if govjob==1, ///
robust partial(i.univ i.workprov  female minor gy age  )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"

eststo m4: ivreg2 parent_govx i.univ i.workprov  female minor age gy   (w_disciplined_1  = postac2 xipost)  if govjob==1, ///
robust partial(i.univ i.workprov  female minor gy age )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"

eststo m5: ivreg2 econhard i.univ i.workprov  female minor age gy   (w_disciplined_1  = postac2 xipost)  if govjob==1, ///
robust partial(i.univ i.workprov  female minor gy age )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"

eststo m6: ivreg2 workpay i.univ i.workprov  female minor age gy   (w_disciplined_1  = postac2 xipost)  if govjob==1, ///
robust partial(i.univ i.workprov  female minor gy age )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"

esttab m*  using out.txt, nonote nogap nobaselevels keep(w_disciplined_1) b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
nomtitles mgroup("Activities in college" "Achievements in college" "Farmer Parents" "Official Parents" "Past economic hardship" "Participation in work-study", pattern(1 1 1 1 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(hj N, labels("Hansen's J (p value)"  "Observations") fmt( 2  0) )




************* Use ALL CASES *******************
eststo clear

eststo m1: ivreg2 ab_rescale i.univ i.colprov  female minor age gy  (disciplined_4_m  = postac2 xipost)  if govjob==1, ///
robust partial(i.univ i.colprov  female minor gy age )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"

eststo m2: ivreg2 gs_rescale i.univ i.colprov  female minor age gy   (disciplined_4_m  = postac2 xipost)  if govjob==1, ///
robust partial(i.univ i.colprov  female minor gy age  )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"

eststo m3: ivreg2 parent_farmer i.univ i.colprov  female minor age gy   (disciplined_4_m  = postac2 xipost)  if govjob==1, ///
robust partial(i.univ i.colprov  female minor gy age  )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"

eststo m4: ivreg2 parent_govx i.univ i.colprov  female minor age gy   (disciplined_4_m  = postac2 xipost)  if govjob==1, ///
robust partial(i.univ i.colprov  female minor gy age )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"

eststo m5: ivreg2 econhard i.univ i.colprov  female minor age gy   (disciplined_4_m  = postac2 xipost)  if govjob==1, ///
robust partial(i.univ i.colprov  female minor gy age )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"

eststo m6: ivreg2 workpay i.univ i.colprov  female minor age gy   (disciplined_4_m  = postac2 xipost)  if govjob==1, ///
robust partial(i.univ i.colprov  female minor gy age )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"

esttab m*  using out.txt, nonote nogap nobaselevels keep(disciplined_4_m) b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
nomtitles mgroup("Activities in college" "Achievements in college" "Farmer Parents" "Official Parents" "Past economic hardship" "Participation in work-study", pattern(1 1 1 1 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(hj N, labels("Hansen's J (p value)"  "Observations") fmt( 2  0) )





************* Only use POSTAC2 as Instrument  *******************

eststo clear
eststo m1: ivreg2 ab_rescale i.univ  i.colprov  female minor  gy   age (disciplined_1   = postac2)  ///
if govjob==1  , robust  partial(i.univ i.colprov   female minor  gy age) cluster(colprov) 
estadd scalar f=`e(cdf)'
estadd local indi "\(\checkmark\)"


eststo m2: ivreg2 gs_rescale i.univ  i.colprov   female minor gy  age  (disciplined_1  = postac2    )  ///
if govjob==1  , robust   partial(i.univ i.colprov   female minor  gy age)  cluster(colprov) 
estadd scalar f=`e(cdf)'
estadd local indi "\(\checkmark\)"


eststo m3: ivreg2 parent_farmer i.univ i.colprov  female minor gy age   (disciplined_1  = postac2   )  ///
if govjob==1     , robust  partial(i.univ i.colprov   female minor  gy age) cluster(colprov) 
estadd scalar f=`e(cdf)'
estadd local indi "\(\checkmark\)"

eststo m4: ivreg2 parent_govx i.univ   i.colprov  female minor  gy age  (disciplined_1  = postac2   )  ///
if govjob==1   , robust  partial(i.univ i.colprov   female minor  gy age) cluster(colprov) 
estadd scalar f=`e(cdf)'
estadd local indi "\(\checkmark\)"

eststo m5: ivreg2 econhard i.univ   i.colprov  female minor  gy age   (disciplined_1  = postac2   )  ///
if govjob==1   , robust  partial(i.univ i.colprov   female minor  gy age)  
estadd scalar f=`e(cdf)'
estadd local indi "\(\checkmark\)"

eststo m6: ivreg2 workpay i.univ   i.colprov  female minor  gy age  (disciplined_1  = postac2   )  ///
if govjob==1   , robust  partial(i.univ i.colprov   female minor  gy age) cluster(colprov) 
estadd scalar f=`e(cdf)'
estadd local indi "\(\checkmark\)"


esttab m*  using out.txt, nonote nogap nobaselevels keep(disciplined_1) b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
nomtitles mgroup("Activities in college" "Achievements in college" "Farmer Parents" "Official Parents" "Past economic hardship" "Participation in work-study", pattern(1 1 1 1 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats( N, labels( "Observations") fmt(  0) )






***************************************************************************************** 
****************	Table 5: Evidence on Policy Preferences		*************************
***************************************************************************************** 


eststo clear
eststo m1: ivreg2 proptax_r i.univ i.colprov  female minor  gy  age (disciplined_1  = postac2 xipost)  ///
if govjob==1  , robust partial(i.univ i.colprov  female minor gy  age)  cluster(colprov)
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"
estadd local ctrl "\(\checkmark\)"

eststo m2: ivreg2 spmedical_r i.univ i.colprov  female minor  gy  age (disciplined_1  = postac2 xipost)  ///
if govjob==1  , robust partial(i.univ i.colprov  female minor gy  age)  cluster(colprov)
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"
estadd local ctrl "\(\checkmark\)"

esttab m*  using out.txt, nonote nogap nobaselevels keep(disciplined_1) b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
nomtitles mgroup("Property tax on second home" "Special medical service for the rich in public hospitals", pattern(1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(colprov uni indi   hj N, labels("College province FE" "MPA program FE" "Individual-level controls" "Hansen's J (p value)" "Observations") fmt(0 0 0 2  0) )







******************************************************************************************************************
******************************************************************************************************************
********************************************* ONLINE APPENDIX ****************************************************
******************************************************************************************************************
******************************************************************************************************************


******************************************************** 
*********	Table A.1: Summary statistics	************
********************************************************

global dv "ability goodstudent2 parent_govx parent_farmer econhard workpay" 
global iv "xipost postac2 disciplined_1 disciplined_4_m "
global cv "party rank_rising age female gy minor workleng worklevel"
global other "money_motive3 pmotive_income pubonly proptax spmedical"

eststo summ: estpost summarize $dv $iv $cv $other  if  govjob==1

esttab summ using out.txt, booktabs ///
nomtitle nonumber noobs cells("mean(fmt(a2)) sd(fmt(a2)) min max count") replace label




esttab m*  using out.txt, nonote nogap nobaselevels keep(disciplined_1) b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
nomtitles mgroup("Activities in college" "Achievements in college" "Farmer Parents" "Official Parents" "Past economic hardship" "Participation in work-study", pattern(1 1 1 1 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(hj N, labels(  "Hansen's J (p value)" "Observations") fmt(  2  0) )



*************************************************************
*********	Table A.2: Validating Ability Measure ************
*************************************************************

eststo clear

eststo m1: reg ability i.colprov gy age female minor govjob prijob2 schoolrank, cluster(univ)
estadd local colprov "\(\checkmark\)"
estadd local indi "\(\checkmark\)"


eststo m2: reg ability   i.colprov   age female minor workleng  party rank_rising if govjob==1, robust
estadd local colprov "\(\checkmark\)"
estadd local indi "\(\checkmark\)"

eststo m3: reg ability   i.colprov   age female minor workleng  party if govjob==0, robust
estadd local colprov "\(\checkmark\)"
estadd local indi "\(\checkmark\)"


eststo m4: reg goodstudent2 i.colprov gy age female minor govjob schoolrank, cluster(univ)
estadd local colprov "\(\checkmark\)"
estadd local indi "\(\checkmark\)"

eststo m5: reg goodstudent2  i.colprov   age female minor  workleng party  rank_rising if govjob==1, robust   
estadd local colprov "\(\checkmark\)"
estadd local indi "\(\checkmark\)"

eststo m6: reg goodstudent2   i.colprov   age female minor workleng  party if govjob==0, robust
estadd local colprov "\(\checkmark\)"
estadd local indi "\(\checkmark\)"


esttab m*  using out.txt, nonote nobaselevels keep(schoolrank rank_rising party) order(schoolrank rank_rising party) b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01)  label booktabs replace   ///
mtitle("Full sample" "Civil servant sample" "Non-civil servant sample" "Full sample" "Civil servant sample" "Non-civil servant sample") ///
mgroup("Activities in college" "Achievements in college", pattern(1 0 0 1 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///p
stats(colprov indi N, labels("College province FE" "Individual-level controls"   "Observations") fmt(0 0  0) )



******************************************************************************************************* 
*******************		Table A.3: Correlation between ability and economic background	 **************
*******************************************************************************************************
eststo clear

eststo m1: reg ab_rescale i.colprov i.univ age gy female minor  parent_farmer parent_govx if govjob==1, robust
estadd local colprov "\(\checkmark\)"

eststo m2: reg ab_rescale i.colprov i.univ age gy female minor  econhard if govjob==1, robust
estadd local colprov "\(\checkmark\)"

eststo m3: reg gs_rescale i.colprov i.univ age gy female minor  parent_farmer parent_govx if govjob==1, robust
estadd local colprov "\(\checkmark\)"

eststo m4: reg gs_rescale i.colprov i.univ age gy female minor  econhard if govjob==1, robust
estadd local colprov "\(\checkmark\)"


esttab m*  using out.txt, nonote nogap nobaselevels keep(age gy female minor  parent_farmer parent_govx econhard) b(3) se(3) ///
order(parent_farmer parent_govx econhard  female minor age gy) star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
nomtitles mgroup("Activities in college" "Achievements in college", pattern(1 0  1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(colprov N, labels("Province fixed effects"  "Observations") fmt(0   0) )





*************************************************************
******** 	Table A.7: Collapse by province-year ************
*************************************************************

preserve
collapse (mean) ab_rescale gs_rescale parent_farmer parent_govx econhard workpay disciplined_1 postac2 xipost female minor  age   if govjob==1,by(colprov gy)

eststo clear
eststo m1: ivreg2 ab_rescale  i.colprov  female minor age gy  (disciplined_1  = postac2 xipost)     , ///
robust partial( i.colprov  female minor gy age )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"

eststo m2: ivreg2 gs_rescale  i.colprov  female minor age gy   (disciplined_1  = postac2 xipost)   , ///
robust partial( i.colprov  female minor gy age  )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"



eststo m3: ivreg2 parent_farmer  i.colprov  female minor age gy   (disciplined_1  = postac2 xipost)  , ///
robust partial( i.colprov  female minor gy age  )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"

eststo m4: ivreg2 parent_govx  i.colprov  female minor age gy   (disciplined_1  = postac2 xipost)    , ///
robust partial( i.colprov  female minor gy age  )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"

eststo m5: ivreg2 econhard  i.colprov  female minor age gy   (disciplined_1  = postac2 xipost)   , ///
robust partial( i.colprov  female minor gy age  )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"

eststo m6: ivreg2 workpay i.colprov  female minor age gy   (disciplined_1  = postac2 xipost)   , ///
robust partial( i.colprov  female minor gy age )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"

esttab m*  using out.txt, nonote nogap nobaselevels keep(disciplined_1) b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
nomtitles mgroup("Activities in college" "Achievements in college" "Farmer Parents" "Official Parents" "Past economic hardship" "Participation in work-study", pattern(1 1 1 1 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(colprov f hj N, labels("Province fixed effects" "First-stage F" "Hansen's J (p value)"  "Observations") fmt(0 2 2  0) )

restore




*******************************************************************************************************
************************ Table A.8: Alternative Methods for Significance Testing **********************
*******************************************************************************************************

************* Unclustered Robust SE *******************
eststo clear

ivreg2 ab_rescale i.univ i.colprov  female minor age gy  (disciplined_1  = postac2 xipost)  if govjob==1, ///
robust   
ivreg2 gs_rescale i.univ i.colprov  female minor age gy  (disciplined_1  = postac2 xipost)  if govjob==1, ///
robust   
ivreg2 parent_farmer i.univ i.colprov  female minor age gy  (disciplined_1  = postac2 xipost)  if govjob==1, ///
robust   
ivreg2 parent_govx i.univ i.colprov  female minor age gy  (disciplined_1  = postac2 xipost)  if govjob==1, ///
robust   
ivreg2 econhard i.univ i.colprov  female minor age gy  (disciplined_1  = postac2 xipost)  if govjob==1, ///
robust   
ivreg2 workpay i.univ i.colprov  female minor age gy  (disciplined_1  = postac2 xipost)  if govjob==1, ///
robust   

************* Wild Bootstrap *******************
ivreg2 ab_rescale i.univ i.colprov  female minor age gy  (disciplined_1  = postac2 xipost)  if govjob==1, ///
robust   cluster(colprov)
boottest disciplined_1=0, seed(0) reps(499) ptype(equaltail)

ivreg2 gs_rescale i.univ i.colprov  female minor age gy  (disciplined_1  = postac2 xipost)  if govjob==1, ///
robust   cluster(colprov)
boottest disciplined_1=0, seed(0) reps(499) ptype(equaltail)

ivreg2 parent_farmer i.univ i.colprov  female minor age gy  (disciplined_1  = postac2 xipost)  if govjob==1, ///
robust   cluster(colprov)
boottest disciplined_1=0, seed(0) reps(499) ptype(equaltail)

ivreg2 parent_govx i.univ i.colprov  female minor age gy  (disciplined_1  = postac2 xipost)  if govjob==1, ///
robust   cluster(colprov)
boottest disciplined_1=0, seed(0) reps(499) ptype(equaltail)

ivreg2 econhard i.univ i.colprov  female minor age gy  (disciplined_1  = postac2 xipost)  if govjob==1, ///
robust   cluster(colprov)
boottest disciplined_1 , seed(0) reps(499)  ptype(equaltail)

ivreg2 workpay i.univ i.colprov female minor age gy   (disciplined_1  = postac2 xipost) if govjob==1, ///
cluster(colprov) 
boottest disciplined_1 , seed(0) reps(499)  ptype(equaltail)



************************************************************* 
**************** 	Table A.9: Reduce Form 		************* 
************************************************************* 

eststo clear
eststo m1: reg ab_rescale i.univ i.colprov  female minor  age gy postac2 xipost  ///
if govjob==1    , robust  cluster(colprov)
test postac2 xipost
estadd scalar pval=`r(p)'
estadd local colprov "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local indi "\(\checkmark\)"

eststo m2: reg gs_rescale i.univ i.colprov  female minor  age gy postac2 xipost  ///
if govjob==1    , robust  cluster(colprov)
test postac2 xipost
estadd scalar pval=`r(p)'
estadd local colprov "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local indi "\(\checkmark\)"

eststo m3: reg parent_farmer i.univ i.colprov  female minor  age gy postac2 xipost  ///
if govjob==1    , robust  cluster(colprov)
test postac2 xipost
estadd scalar pval=`r(p)'
estadd local colprov "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local indi "\(\checkmark\)"

eststo m4: reg parent_govx i.univ i.colprov  female minor  age gy postac2 xipost  ///
if govjob==1    , robust  cluster(colprov)
test postac2 xipost
estadd scalar pval=`r(p)'
estadd local colprov "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local indi "\(\checkmark\)"

eststo m5: reg econhard i.univ i.colprov  female minor  age gy postac2 xipost  ///
if govjob==1    , robust  cluster(colprov)
test postac2 xipost
estadd scalar pval=`r(p)'
estadd local colprov "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local indi "\(\checkmark\)"

eststo m6: reg workpay i.univ i.colprov  female minor  age gy postac2 xipost  ///
if govjob==1    , robust  cluster(colprov)
test postac2 xipost
estadd scalar pval=`r(p)'
estadd local colprov "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local indi "\(\checkmark\)"

esttab m*  using out.txt, nonote nobaselevels keep(postac2 xipost) b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
nomtitles mgroup("Activities in college" "Achievements in college" "Farmer parents" "Official Parents" "Past economic hardship" "Participation in work-study", pattern(1 1 1 1 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///p
stats(pval colprov uni indi    N, labels("Join significance test (p-value)" "College province FE" "MPA program FE" "Individual-level controls"   "Observations") fmt(2 0 0 0  0) )




*************************************************************************************************
***************** 	Table A.10: Use Xi province X Post as the only IV (DID) *********************
*************************************************************************************************

eststo clear
eststo m1: ivreg2 ab_rescale i.univ i.colprov  female minor i.gy age $econ (disciplined_1  =   xipost)  if govjob==1, ///
robust    cluster(colprov)
estadd scalar f=`e(cdf)'
estadd local colprov "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local indi "\(\checkmark\)"

eststo m2: ivreg2 gs_rescale i.univ i.colprov  female minor i.gy age $econ (disciplined_1  =   xipost)  if govjob==1, ///
robust     cluster(colprov)
estadd scalar f=`e(cdf)'
estadd local colprov "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local indi "\(\checkmark\)"

eststo m3: ivreg2 parent_farmer i.univ i.colprov  female minor i.gy age $econ (disciplined_1  =   xipost)  if govjob==1, ///
robust    cluster(colprov)
estadd scalar f=`e(cdf)'
estadd local colprov "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local indi "\(\checkmark\)"


eststo m4: ivreg2 parent_govx i.univ i.colprov  female minor i.gy age $econ  (disciplined_1  =   xipost)  if govjob==1, ///
robust     cluster(colprov)
estadd scalar f=`e(cdf)'
estadd local colprov "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local indi "\(\checkmark\)"

eststo m5: ivreg2 econhard i.univ i.colprov  female minor i.gy age $econ (disciplined_1  =   xipost)  if govjob==1, ///
robust    cluster(colprov)
estadd scalar f=`e(cdf)'
estadd local colprov "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local indi "\(\checkmark\)"

eststo m6: ivreg2 workpay i.univ i.colprov  female minor i.gy age $econ (disciplined_1  =   xipost)  if govjob==1, ///
robust   cluster(colprov)
estadd scalar f=`e(cdf)'
estadd local colprov "\(\checkmark\)"
estadd local uni "\(\checkmark\)"
estadd local indi "\(\checkmark\)"

esttab m*  using out.txt, nonote nobaselevels keep(disciplined_1) b(3) se(3) ///
star(* 0.1 ** 0.05 *** 0.01) label booktabs replace   ///
nomtitles mgroup("Activities in college" "Achievements in college" "Farmer parents" "Official parents" "Past economic hardship" "Participation in work-study", pattern(1 1 1 1 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///p
stats(colprov uni indi    N, labels("College province FE" "MPA program FE" "Individual-level controls"   "Observations") fmt(0 0 0  0) )






***************************************************************************************** 
****************	Table A.11: Remove all official children    *************************
***************************************************************************************** 

eststo clear

eststo m1: ivreg2 ab_rescale i.univ i.colprov  female minor age gy  (disciplined_1  = postac2 xipost)  if govjob==1 & parent_govx==0, ///
robust partial(i.univ i.colprov  female minor gy age )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"

eststo m2: ivreg2 gs_rescale i.univ i.colprov  female minor age gy   (disciplined_1  = postac2 xipost)  if govjob==1 & parent_govx==0, ///
robust partial(i.univ i.colprov  female minor gy age  )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"

eststo m3: ivreg2 econhard i.univ i.colprov  female minor age gy   (disciplined_1  = postac2 xipost)  if govjob==1 & parent_govx==0, ///
robust partial(i.univ i.colprov  female minor gy age  )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"

eststo m4: ivreg2 workpay i.univ i.colprov  female minor age gy   (disciplined_1  = postac2 xipost)  if govjob==1 & parent_govx==0, ///
robust partial(i.univ i.colprov  female minor gy age )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"


esttab m*  using out.txt, nonote nogap nobaselevels keep(disciplined_1) b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
nomtitles mgroup("Activities in college" "Achievements in college" "Past economic hardship" "Participation in work-study", pattern(1 1 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(hj N, labels("Hansen's J (p value)"  "Observations") fmt( 2  0) )


**********************************************************************************************
****************	Table A.12: Children of high vs. low-ranking officials    ****************
**********************************************************************************************

eststo clear

eststo m3: ivreg2 parent_gov_h i.univ i.colprov  female minor age gy   (disciplined_1  = postac2 xipost)  if govjob==1  , ///
robust partial(i.univ i.colprov  female minor gy age  )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"

eststo m4: ivreg2 parent_gov_l i.univ i.colprov  female minor age gy   (disciplined_1  = postac2 xipost)  if govjob==1, ///
robust partial(i.univ i.colprov  female minor gy age )  cluster(colprov)
estadd scalar f=`e(cdf)'
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"


esttab m*  using out.txt, nonote nogap nobaselevels keep(disciplined_1) b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
nomtitles mgroup("Official Parents (high-ranking)" "Official parents (low-ranking)", pattern(1 1  ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(hj N, labels("Hansen's J (p value)"  "Observations") fmt( 2  0) )




********************************************************************** 
****************	Figure A.6: Results by Subsample  ****************
********************************************************************** 

foreach i of varlist ab_rescale gs_rescale parent_farmer parent_govx econhard workpay {

// better schools //
ivreg2 `i' i.univ i.colprov  female minor  age gy (disciplined_1   = postac2 xipost)  ///
if govjob==1 & goodschool==1  , robust  cluster(colprov)
margins, dydx(disciplined_1)
expmat good1_`i'

// other schools //
ivreg2 `i' i.univ i.colprov  female minor  age gy (disciplined_1   = postac2 xipost)  ///
if govjob==1 & goodschool==0  , robust  cluster(colprov)
margins, dydx(disciplined_1)
expmat good2_`i'


// northern schools //
ivreg2 `i' i.univ i.colprov  female minor  age gy (disciplined_1   = postac2 xipost)  ///
if govjob==1 & south==0  , robust  cluster(colprov)
margins, dydx(disciplined_1)
expmat north1_`i'

// southern schools //
ivreg2 `i' i.univ i.colprov  female minor  age gy (disciplined_1   = postac2 xipost)  ///
if govjob==1 & south==1  , robust  cluster(colprov)
margins, dydx(disciplined_1)
expmat north2_`i'

// female //
ivreg2 `i' i.univ i.colprov    minor  age gy (disciplined_1   = postac2 xipost)  ///
if govjob==1 & female==1  , robust  cluster(colprov)
margins, dydx(disciplined_1)
expmat female1_`i'

// male //
ivreg2 `i' i.univ i.colprov    minor  age gy (disciplined_1   = postac2 xipost)  ///
if govjob==1 & female==0  , robust  cluster(colprov)
margins, dydx(disciplined_1)
expmat female2_`i'


// working at city-level or above //
ivreg2 `i' i.univ i.colprov  female minor  age gy (disciplined_1   = postac2 xipost)  ///
if govjob==1 & cityup==1  , robust  cluster(colprov)
margins, dydx(disciplined_1)
expmat city1_`i'

// working at county-level or lower //
ivreg2 `i' i.univ i.colprov  female minor  age gy (disciplined_1   = postac2 xipost)  ///
if govjob==1 & cityup==0  , robust  cluster(colprov)
margins, dydx(disciplined_1)
expmat city2_`i'


// working outside Xi province //
ivreg2 `i' i.univ i.colprov  female minor  age gy (disciplined_1   = postac2 xipost)  ///
if govjob==1 & work_xi==0  , robust  cluster(colprov)
margins, dydx(disciplined_1)
expmat xi2_`i'


}





*************************************************************************************
*************** 	Figure A.7: Results with Post-Stratification	 **************** 
*************************************************************************************


local w  "pw_o pw_trecruit pw_grad pw_mpa2 pw_mpa3"
local dv "ab_rescale gs_rescale parent_farmer parent_govx econhard workpay"
forv i=1/5{
local a `:word `i' of  `w''
	forv j=1/6{
	local d `: word `j' of `dv''
	ivreg2 `d' i.univ  i.colprov  female minor  gy   age (disciplined_1   = postac2 xipost)  ///
	if govjob==1 [aw=`a'] , robust  cluster(colprov) 
	margins, dydx(disciplined_1)
	expmat m`i'_`j'
	}
}





***************************************************************************************************************************** 
****************	Table A.14: Higher ability individuals less committed to government jobs		*************************
*****************************************************************************************************************************


eststo clear
eststo m1: reg pubonly  i.univ i.colprov i.workprov   worklevel age    female minor  ability govjob prijob2   workleng   , robust 
estadd local fe "\(\checkmark\)"

eststo m2: reg pubonly  i.univ i.colprov i.workprov   worklevel age  female minor  goodstudent2 govjob prijob2  workleng  , robust
estadd local fe "\(\checkmark\)"


esttab m*  using out.txt, nonote nogap nobaselevels keep( workleng worklevel age  female minor  ability goodstudent2 ) b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
order(ability goodstudent2 age minor female workleng  worklevel   ) ///
nomtitles mgroup("DV: Commitment to Government Job (4 level)", pattern(1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(fe N, labels("MPA and college fixed effects" "Observations") fmt(0 0) )


***************************************************************************************************************************** 
****************	Table A.15: Poorer families are more motivated by monetary considerations		*************************
*****************************************************************************************************************************


eststo clear
eststo m1: reg money_motive3  i.univ  i.colprov   party age rank_rising  female minor  parent_govx parent_farmer if econhard!=.  , robust
estadd local fe "\(\checkmark\)"
estadd local indi "\(\checkmark\)"

eststo m2: reg money_motive3  i.univ  i.colprov   party age rank_rising  female minor  econhard , robust
estadd local fe "\(\checkmark\)"
estadd local indi "\(\checkmark\)"


eststo m3: reg money_motive3  i.univ  i.colprov   party age rank_rising  female minor  workpay , robust
estadd local fe "\(\checkmark\)"
estadd local indi "\(\checkmark\)"

eststo m4: reg pmotive_income i.univ  i.colprov   party age rank_rising  female minor parent_farmer parent_govx  , robust
estadd local fe "\(\checkmark\)"
estadd local indi "\(\checkmark\)"

eststo m5: reg pmotive_income i.univ  i.colprov   party age rank_rising  female minor  econhard , robust
estadd local fe "\(\checkmark\)"
estadd local indi "\(\checkmark\)"

eststo m6: reg pmotive_income  i.univ  i.colprov   party age rank_rising  female minor  workpay , robust
estadd local fe "\(\checkmark\)"
estadd local indi "\(\checkmark\)"

esttab m*  using out.txt, nonote nogap nobaselevels keep(parent_farmer parent_govx  econhard workpay) b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
order(parent_farmer parent_govx  econhard workpay) ///
nomtitles mgroup("Monetary Motivation (Self)" "Monetary Motivation (Parents')", pattern(1 0 0 1 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(indi fe  N, labels("Individual controls" "MPA and college fixed effects" "Observations") fmt(0 0 0) )



************************************************************************************************* 
****************	Table A.16: Placebo: Non-civil servant sample		*************************
************************************************************************************************* 


eststo clear
eststo m1: ivreg2 ability i.univ  i.colprov  female minor  gy age  (disciplined_1  = postac2 xipost)  ///
if govjob==0 , robust  partial(i.univ i.colprov   female minor  gy age) cluster(colprov)
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"


eststo m2: ivreg2 goodstudent2 i.univ  i.colprov   female minor gy age (disciplined_1  = postac2 xipost)  ///
if govjob==0   , robust partial(i.univ i.colprov    female minor  gy age)  cluster(colprov)   
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"


eststo m3: ivreg2 parent_farmer i.univ i.colprov  female minor gy  age (disciplined_1  = postac2 xipost)  ///
if govjob==0  , robust partial(i.univ i.colprov  female minor  gy age)  cluster(colprov)
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"

eststo m4: ivreg2 parent_govx i.univ   i.colprov  female minor  gy  age (disciplined_1  = postac2 xipost)  ///
if govjob==0  , robust partial(i.univ i.colprov  female minor gy  age)  cluster(colprov)
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"


eststo m5: ivreg2 econhard i.univ i.colprov  female minor gy  age (disciplined_1  = postac2 xipost)  ///
if govjob==0  , robust partial(i.univ i.colprov  female minor  gy age)  cluster(colprov)
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"

eststo m6: ivreg2 workpay i.univ   i.colprov  female minor  gy  age (disciplined_1  = postac2 xipost)  ///
if govjob==0  , robust partial(i.univ i.colprov  female minor gy  age)  cluster(colprov)
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"

esttab m*  using out.txt, nonote nogap nobaselevels keep(disciplined_1) b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
nomtitles mgroup("Activities in college" "Achievements in college" "Farmer Parents" "Official Parents" "Past economic hardship" "Participation in work-study", pattern(1 1 1 1 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(hj N, labels("Hansen's J (p value)"  "Observations") fmt( 2  0) )



**************************************************************************
**************** Figure A.9: Placebo on Individual Level Outcomes ******** 
**************************************************************************

foreach i of varlist  age female minor workleng party worklevel rank {
capture drop dv
g dv=`i'
sum `i' if govjob==1
replace dv=(dv-`r(mean)')/`r(sd)'

ivreg2 dv i.univ i.colprov  gy   (disciplined_1 = postac2 xipost)  if govjob==1 , robust  
margins, dydx(disciplined_1)  noestimcheck
expmat indibal_`i'
}

// only govjob==1 //
foreach i of varlist  govjob pubjob bussijob {
capture drop dv
g dv=`i'
sum `i'
replace dv=(dv-`r(mean)')/`r(sd)'

// look at compositions within sample //
ivreg2 dv i.univ i.colprov  gy     (disciplined_1  = postac2 xipost)   , robust    
margins, dydx(disciplined_1)  
expmat indibal_`i'
}




******************************************************************************
********** 	Table A.17: Increasing Workload? Remove grassroots ***************
******************************************************************************
eststo clear
eststo m1: ivreg2 ab_rescale i.univ i.colprov  female minor age gy  (disciplined_1  = postac2 xipost)  if govjob==1 & worklevel<=4, ///
robust partial(i.univ i.colprov  female minor age gy)   cluster(colprov)
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"
estadd local uni "\(\checkmark\)"


eststo m2: ivreg2 gs_rescale i.univ i.colprov  female minor age gy  (disciplined_1  = postac2 xipost)  if govjob==1 & worklevel<=4, ///
robust partial(i.univ i.colprov  female minor age gy)   cluster(colprov)
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"
estadd local uni "\(\checkmark\)"


eststo m3: ivreg2 parent_farmer i.univ i.colprov  female minor age gy   (disciplined_1  = postac2 xipost)  if govjob==1& worklevel<=4, ///
robust partial(i.univ i.colprov  female minor age gy  )   cluster(colprov)
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"
estadd local uni "\(\checkmark\)"

eststo m4: ivreg2 parent_govx i.univ i.colprov  female minor age gy  (disciplined_1  = postac2 xipost)  if govjob==1 & worklevel<=4, ///
robust partial(i.univ i.colprov  female minor age gy )   cluster(colprov)
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"
estadd local uni "\(\checkmark\)"

eststo m5:ivreg2 econhard i.univ i.colprov  female minor age gy   (disciplined_1  = postac2 xipost)  if govjob==1 & worklevel<=4, ///
robust partial(i.univ i.colprov  female minor age gy )   cluster(colprov)
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"
estadd local uni "\(\checkmark\)"

eststo m6: ivreg2 workpay i.univ i.colprov  female minor age gy  (disciplined_1  = postac2 xipost)  if govjob==1 & worklevel<=4, ///
robust partial(i.univ i.colprov  female minor age gy )   cluster(colprov)
estadd scalar hj=`e(jp)'
estadd local indi "\(\checkmark\)"
estadd local colprov "\(\checkmark\)"
estadd local uni "\(\checkmark\)"

esttab m*  using out.txt, nonote nogap nobaselevels keep(disciplined_1) b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
nomtitles mgroup("Activities in college" "Achievements in college" "Farmer parents" "Official parents" "Past economic hardship" "Participation in work-study", pattern(1 1 1 1 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(colprov uni indi     hj N, labels("College province FE" "MPA program FE" "Individual-level controls"  "Hansen's J (p value)" "Observations") fmt(0 0 0 2  0) )




*********************************************************************************************************
********** Table A.18: Difference in Policy Preference Across Class and Family Background ***************
*********************************************************************************************************

// Farmer vs. Official //
eststo clear

eststo m4: reg proptax  i.univ  i.colprov     party  female minor  gy   parent_govx  parent_farmer   , robust // property tax
test parent_govx=parent_farmer
estadd scalar t=`r(p)'
estadd scalar diff=_b[parent_farmer]-_b[parent_govx]
estadd local indi "\(\checkmark\)"
estadd local mpa "\(\checkmark\)"


eststo m5: reg spmedical  i.univ  i.colprov     party  female minor  gy    parent_govx  parent_farmer      , robust // special medical service for the rich
test parent_govx=parent_farmer
estadd scalar t=`r(p)'
estadd scalar diff=_b[parent_farmer]-_b[parent_govx]
estadd local indi "\(\checkmark\)"
estadd local mpa "\(\checkmark\)"


esttab m*  using out.txt, nonote nogap nobaselevels keep(parent_farmer parent_govx) b(3) se(3) ///
order(parent_farmer parent_govx) star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
nomtitles mgroup("Property tax on second home" "Special medical service for the rich in public hospitals", pattern( 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(diff t indi mpa N, labels("A\(-\)B (\(\beta\))" "A\(-\)B (p value) " "College province FE" "MPA program FE" "Observations") fmt(2 3 0 0 0) )


// Economic experience //


eststo clear

eststo m4: reg proptax  i.univ  i.colprov     party  female minor  gy    econhard  , robust // property tax
estadd local indi "\(\checkmark\)"
estadd local mpa "\(\checkmark\)"

eststo m5: reg spmedical  i.univ  i.colprov     party  female minor  gy    econhard  , robust // special medical service for the rich
estadd local indi "\(\checkmark\)"
estadd local mpa "\(\checkmark\)"



esttab m*  using out.txt, nonote nogap nobaselevels keep(econhard) b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01)  label booktabs replace   ///
nomtitles mgroup("Property tax on second home" "Special medical service for the rich in public hospitals", pattern( 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(indi mpa N, labels("College province FE" "MPA program FE" "Observations") fmt(0 0  0) )

